import { Controller, Get, Post, Body, HttpCode, Query, UseGuards } from '@nestjs/common';
import { FeedbackService } from './feedback.service';
import { ApiResponse, ApiOperation, ApiBody, ApiQuery, ApiTags } from '@nestjs/swagger';
import { CreateFeedbackDto, GetFeedbackPageDot } from './dto/feedback.dto';
import { FeedbackResult } from './entities/feedback.entity';
import { AuthGuard } from '@nestjs/passport';
@ApiTags('问题反馈')
@Controller('admin/feedback')
export class FeedbackController {
  constructor(private readonly feedbackService: FeedbackService) { }
  /** 问题反馈列表 */
  @HttpCode(200)
  @Get('/getFeedbackPage')
  @ApiResponse({
    status: 200,
    description: '问题反馈列表',
    type: FeedbackResult,
  })
  @ApiOperation({
    tags: ['获取问题反馈列表'],
    summary: '获取问题反馈列表',
    operationId: 'getFeedbackPage',
  })
  @UseGuards(AuthGuard('jwt')) // 自定义守卫
  getFeedbackPage(@Query() params: GetFeedbackPageDot) {
    return this.feedbackService.getFeedbackPage(params);
  }
  @HttpCode(200)
  @Post('/createFeedback')
  @ApiQuery({
    description: '创建问题反馈',
    type: CreateFeedbackDto,
  })
  @ApiBody({ description: '创建问题反馈', type: CreateFeedbackDto })
  @ApiOperation({ summary: '创建问题反馈', operationId: 'createFeedback' })
  @ApiResponse({ status: 200, type: String })
  createFeedback(@Body() body: CreateFeedbackDto) {
    return this.feedbackService.createFeedback(body);
  }
}
